package en.tedu.mybatosannotatio.mapper;

import en.tedu.mybatosannotatio.pojo.WeiBo;
import en.tedu.mybatosannotatio.pojo.weiBoVo;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.Alias;

import java.util.List;

@Mapper
public interface WeiBoMapper {
    @Insert("INSERT INTO weibo VALUES (NULL,#{contend},#{created},#{user_id})")
    void insert(WeiBo weiBo);
   @Delete("Delete From weibo WHERE id=#{id}")
   void delete (WeiBo weiBo);

    @Update("UPDATE  weibo  SET content=#{contend},created=#{created} WHERE id=#" +
            "{id}")
    void update(WeiBo weiBo)  ;
    @Select("SELECT weibo.content, weibo.created,user.id  FROM weibo,user,comment " +
            "WHERE comment.user_id=user.id AND comment.weibo_id=weibo.id  ")
    List<weiBoVo> selectAll();



}
